package gui;

import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;

import javax.swing.JPanel;

import sim.World;

public class MainPanel extends JPanel
{
	private World world;
	private final ControlsPanel controlsPanel;
	private final WorldDisplayPanel worldDisplayPanel;
	public MainPanel()
	{
		world = new World();
		controlsPanel = new ControlsPanel(world);
		worldDisplayPanel = new WorldDisplayPanel(world,controlsPanel);
		buildGui();
	}

	private void buildGui() 
	{
		setLayout(new GridBagLayout());
		GridBagConstraints gbc = new GridBagConstraints();
		gbc.gridx = 0;
		gbc.gridy = 0;
		gbc.weightx=1;
		gbc.weighty=1;
		gbc.fill = GridBagConstraints.BOTH;
		add(worldDisplayPanel,gbc);
		
		gbc.gridx = 0;
		gbc.gridy = 1;
		gbc.weightx=0;
		gbc.weighty=0;
		gbc.fill = GridBagConstraints.HORIZONTAL;
		add(controlsPanel,gbc);
	}
}
